$(function(){
    $(document).ready(function () {
        $.ajax({
            url: "http://127.0.0.1:8080/static/data/classification1.json"
        })
            .done(function (data) {
                render2(data)
                 console.log(data)
            })
    });
    $(".search_itemlist").lazyload()
    $(".img1").lazyload()
    console.log($(".img1"))
    let $search_itemlist=$(".search_itemlist")
     console.log($search_itemlist)
    function render2(data){
        // console.log(data.list.sp1)
        console.log(data.list)
        $search_itemlist[0].innerHTML+=data.list.map(item=>
            `
        <div class="item_main wnqc">
        <a href="./大麦网商品详情.html#id=${item.id}">
            <img src="${item.img}"
                alt="" class="img1">
            <span>演唱会</span>
        </a>
        <div class="items_txt">
            <div class="items_txt_title">
                <span class="sp1">${item.sp1}</span>
                <span class="sp2">${item.sp2}</span>
                <div class="items_txt_time">
                    ${item.items_txt_time}
                </div>
            </div>
            <div class="items_txt_time items_txt_time1">
                <a href="#"></a>
                ${item.items_txt_time1}
            </div>
            <div class="items_txt_time items_txt_time2">
                <a href="#"></a>
                ${item.items_txt_time2}
            </div>
            <div class="items_txt_price">
                <span>${item.items_txt_price}<i>元</i></span>
                售票中
            </div>
        </div>
    </div> 
        `).join("")
    }
    let $sp1=$(".factor-content span")
    console.log($sp1)
    for(let i=0;i<$sp1.length;i++){
        $sp1.click(function(){
            $(this).addClass("active2").siblings().removeClass("active2")
            }) 
    }
})